import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../res/theme.dart';

class AppBtn extends StatelessWidget {
  const AppBtn({ Key? key,
    this.content,
    this.onTap,
    this.height = 45,
    this.style,
    this.child,
    this.radius = 90,
    this.backgroundColor,
    this.margin,
    this.textColor
  }) : super(key: key);

  final double radius;
  final String? content;
  final Function? onTap;
  final double height;
  final TextStyle? style;
  final Widget? child;
  final Color? backgroundColor;
  final Color? textColor;
  final EdgeInsets? margin;

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: margin,
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(radius),
          // border: Border.all(color: backgroundColor ?? AppTheme.mainColor)
      ),
      child: ClipRRect(
        borderRadius: BorderRadius.circular(radius),
        child: Material(
          borderRadius: BorderRadius.circular(radius),
          child: Ink(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(radius),
              // gradient: gradient == true ? const LinearGradient(
              //     begin: Alignment.centerLeft,
              //     end: Alignment.center,
              //     colors: [
              //       Color(0xFF9F74FB),
              //       Color(0xFF7A3FF1)
              //     ]
              // ) : LinearGradient(
              //     begin: Alignment.topCenter,
              //     end: Alignment.bottomCenter,
              //     colors: (lightTheme || outline == true) ? [
              //       const Color(0xFFFFFFFF),
              //       const Color(0xFFFFFFFF)
              //     ] : [
              //       AppTheme.button,
              //       AppTheme.button
              //     ]
              // ),
              color: backgroundColor ?? AppTheme.mainColor
            ),
            child: InkWell(
              splashColor: Colors.white24,
              onTap: (){
                onTap?.call();
              },
              child: SizedBox(
                width: double.infinity,
                height: height.h,
                child: child ?? Center(child: Text(content!, style: style
                    ?? TextStyle(fontSize: 14,
                        color: textColor ?? Colors.white,
                        fontWeight: FontWeight.bold))),
              ),
            ),
          ),
        ),
      ),
    );
  }

}